package no.nordicsemi.android.nrfmesh.devmode;

import android.content.Context;
import android.content.SharedPreferences;

/** 离线解锁开发者模式：Demo 简化版 */
public final class DevModeGate {
    private static final String PREF = "dev_gate";
    private static final String K_ENABLED = "enabled";
    /** Demo 固定口令；Release 可改为基于日期/HMAC 的一次性口令 */
    public static final String DEMO_PASSPHRASE = "DEV-2025";

    public static boolean enabled(Context c){
        return c.getSharedPreferences(PREF, Context.MODE_PRIVATE).getBoolean(K_ENABLED, false);
    }
    public static void enable(Context c){
        c.getSharedPreferences(PREF, Context.MODE_PRIVATE).edit().putBoolean(K_ENABLED, true).apply();
    }
    public static void disable(Context c){
        c.getSharedPreferences(PREF, Context.MODE_PRIVATE).edit().remove(K_ENABLED).apply();
    }
}
